#ifndef _HTTP_GLOBAL_H_
#define _HTTP_GLOBAL_H_

#include <malloc.h>
#include <unistd.h>
#include <string>
#include <stdint.h>
#include <defs.h>
#include <zlib.h>
#include "connect_info.h"

class BSTimer;
typedef struct _TimerStruct
{
    unsigned ExeTime;
    BSTimer *timer;
}TimerStruct;


HTTP_SVR_NS_BEGIN

class THttpStateInfo;
class CClientUnit;
class CHelperUnit;
class CListener;

typedef struct _FdInfo
{
    CClientUnit*    pClientUnit;
    CHelperUnit*    pHelperUnit;
    THttpStateInfo* pHttpInfo;
    ConnectInfo     connectInfo;
}FdInfo;

typedef struct t
{
	int _t_t;
}____t__;

class TGlobal
{
public: //method
    static void ShowVersion(void);
    static void ShowUsage(void);
    static int DaemonInit(const char* conf_file);
    static void DaemonStart(void);


    static std::string trim(std::string &s); 
    static std::string ltrim(std::string &s); 
    static std::string rtrim(std::string &s); 

public: //property
    static volatile int*    _module_close;
    static volatile int     _stopped;
    static const char*      _progname;
    static const char*      _version;
    static int              _background;
    static std::string      _config_file;
    
public:
    static char            _addr[64];  
    static uint16_t        _port;  
    static int             _backlog;
    static int             _maxpoller;
    static int             _webtimeout;
    static int             _helpertimeout;
    static int             _max_req_head_lenth;
    static int             _max_req_body_lenth;
	static std::string	   _FIFO_path;
	static bool			   _status_log;
	static DebugMem*	   _debug_mem;

	static std::string     _server_ip;
	static int             _server_port;
	static std::string     _old_server_ip;
	static int             _old_server_port;
	static std::string     _server_key;

		
private: //no impl
    TGlobal (void);
    ~TGlobal (void);
    TGlobal (const TGlobal&);
    const TGlobal& operator= (const TGlobal&);
    
private: //method
    static void update_handler(int signo);
};

HTTP_SVR_NS_END

#endif // #define _HTTP_GLOBAL_H_
